package com.ttdc.service;

import java.util.Date;
import java.util.List;

import org.junit.Before;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Service;

import com.ttdc.mapper.DishesMapper;
import com.ttdc.mapper.OrderListMapper;
import com.ttdc.pojo.Dishes;
import com.ttdc.pojo.DishesExample;
import com.ttdc.pojo.OrderListExample;
@Service
public class DishesServiceImpl implements DishesService {
	@Autowired
	private DishesMapper dishesMapper;
	private DishesExample example;
	private ApplicationContext applicationContext;
	@Before
	public void setUp() throws Exception {
		applicationContext = new ClassPathXmlApplicationContext("classpath:springmvc.xml");
		dishesMapper=(DishesMapper) applicationContext.getBean("dishesMapper");
		example=new DishesExample();
		
	}

	@Override
	public int countByExample(DishesExample example) {
		// TODO Auto-generated method stub
		return dishesMapper.countByExample(example);
	}

	@Override
	public int deleteByExample(DishesExample example) {
		// TODO Auto-generated method stub
		return dishesMapper.deleteByExample(example);
	}

	@Override
	public int deleteByPrimaryKey(Integer cpId) {
		// TODO Auto-generated method stub
		return dishesMapper.deleteByPrimaryKey(cpId);
	}

	@Override
	public int insert(Dishes record) {
		// TODO Auto-generated method stub
		return dishesMapper.insert(record);
	}

	@Override
	public int insertSelective(Dishes record) {
		// TODO Auto-generated method stub
		return dishesMapper.insertSelective(record);
	}

	@Override
	public List<Dishes> selectByExample(DishesExample example) {
		// TODO Auto-generated method stub
		return dishesMapper.selectByExample(example);
	}

	@Override
	public Dishes selectByPrimaryKey(Integer cpId) {
		// TODO Auto-generated method stub
		return dishesMapper.selectByPrimaryKey(cpId);
	}

	@Override
	public int updateByExampleSelective(Dishes record, DishesExample example) {
		// TODO Auto-generated method stub
		return dishesMapper.updateByExampleSelective(record, example);
	}

	@Override
	public int updateByExample(Dishes record, DishesExample example) {
		// TODO Auto-generated method stub
		return dishesMapper.updateByExample(record, example);
	}

	@Override
	public int updateByPrimaryKeySelective(Dishes record) {
		// TODO Auto-generated method stub
		return dishesMapper.updateByExampleSelective(record, example);
	}

	@Override
	public int updateByPrimaryKey(Dishes record) {
		// TODO Auto-generated method stub
		System.out.println(record);
		return dishesMapper.updateByPrimaryKey(record);
	}

	@Override
	public List<Dishes> selectByAll() {
		// TODO Auto-generated method stub
		
		return dishesMapper.selectByAll();
	}

}
